package com.ssy.lingxi.platform.manage.repository;


import com.ssy.lingxi.platform.manage.entity.content.ContentCategory;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface ContentCategoryRepository extends JpaRepository<ContentCategory, Long>, JpaSpecificationExecutor<ContentCategory> {

    List<ContentCategory> findAllByLevel(Integer level, Sort id);

    List<ContentCategory> findAllByStatusAndLevel(Integer status, Integer level);

    Long countAllByParentId(Long parentId);

    Boolean existsByParentId(Long parentId);

    List<ContentCategory> findAllByNameContaining(String searchContent);
}
